<script type="text/javascript">
$(function () {
	var url = '${contextPath}script/sys/role.js?time=' + sys_get_time();
	$.ajax({url:url, dataType:'script', cache:true,
		success: function(){
			
		}
	});
});
function saveRoleHandle_role() {

	var handleList = '';
	$('input[type="checkbox"]').each(function() {
		if ($(this).attr('checked') == 'checked')
			handleList += $(this).attr('id') + ',';
	});
	$('input[handleType="hidden"]').each(function() {
		if ($(this).attr('checked') == 'checked')
			handleList += $(this).attr('id') + ',';
	});
	var parm = {'code':'${code}', 'handleList':handleList.substring(0, handleList.length - 1)};
	var url = create_url('organRole-saveHandle');
	sys_submiting();
	$.ajax({type:'POST', url:url, data:parm,
		success : function(result) {
			sys_submiting_close();
			if (result == 'success') {
				sys_msg('操作成功!');
				queryRole_role();
				$.fn.colorbox.close();
			} else {
				sys_warning('操作失败!');
			}
		}
	});
}

</script>

<a class="btn btn-info" href="javascript:;" onclick="javascript:saveRoleHandle_role();" style="margin:5px 0 5px 0"><i class="fontello-icon-floppy"></i> 保存角色可进行对应的操作</a>
<#list menu as sys>
<#if (orgHandleMap?? && orgHandleMap[sys.code]??)>
<div class="panelHead">
	<input type="checkbox" id="${sys.code}" onclick="javascript:selectedOrganType_role('${sys.code}')"<#if (handleMap?? && handleMap[sys.code]??)> checked="checked"</#if> />
	<a href="javascript:;" onclick="javascript:showOrHide_role($(this), 'div_${sys.code}');">${sys.name}</a>
	<span style="float:right; font-size:12px; font-weight:normal;"><a href="javascript:;" onclick="javascript:showOrHide_role($(this), 'div_${sys.code}');">展开 / 隐藏</a></span>
</div>
<div class="panelContent" id="div_${(sys.code)!''}" style="display:none;">
	<#list sys.moduleList as mo>
	<#if (orgHandleMap?? && orgHandleMap[mo.code]??)>
		<div style="border-bottom:1px dashed #ccc;padding:10px 0">
			<p style="width:750px;float:left;line-height:20px;font-weight: bold;margin-left:15px;">
				<input type="checkbox" id="${mo.code}" parentCode="${sys.code}" onclick="javascript:selectedOrganType_role('${mo.code}')"<#if (handleMap?? && handleMap[mo.code]??)> checked="checked"</#if> />
				${mo.name}&nbsp;(${mo.des})
			</p>
			<p>
			<#list mo.menuList as me>
			<#if (orgHandleMap?? && orgHandleMap[me.code]??)>
				<div style="border-bottom:1px dashed #ccc;padding:10px 0">
					<p style="width:750px;float:left;line-height:20px;font-weight: bold;margin-left:30px;">
							<input type="checkbox" id="${me.code}" parentCode="${mo.code}" onclick="javascript:selectedOrganType_role('${me.code}')"<#if (handleMap?? && handleMap[me.code]??)> checked="checked"</#if> />
						${me.name}(${me.des})
					</p>
					<p style="line-height:20px;margin-left:45px;">
					<#list me.handleList as h>
						<#if (orgHandleMap?? && orgHandleMap[h.code]??)>
							<#if !(h.hide)>
							<input type="checkbox" id="${h.code}" parentCode="${me.code}" onclick="javascript:selectedOrganType_role('${h.code}')"<#if (handleMap?? && handleMap[h.code]??)> checked="checked"</#if> />&nbsp;${h.name}
							<#else>
							<input type="hidden" id="${h.code}" parentCode="${me.code}" handleType="hidden" onclick="selectedOrganType_role(this.id)"<#if (handleMap?? && handleMap[h.code]??)> checked="checked"</#if> />
							</#if>
						</#if>
					</#list>
					</p>
				</div>
			</#if>
			</#list>
			</p>
		</div>
	</#if>
	</#list>
</div>
</#if>
</#list>


<a class="btn btn-info" href="javascript:;" onclick="javascript:saveRoleHandle_role();" style="margin:5px 0 5px 0"><i class="fontello-icon-floppy"></i> 保存角色可进行对应的操作</a>
